<?php

use Phinx\Migration\AbstractMigration;

class CreateCodeIndexInResourceTable extends AbstractMigration
{
    public function up()
    {

        $this->table("resource")
            ->addIndex(['code'], ['type' => 'unique', 'name' => 'idx_unique_code_in_resource'])
            ->save();
    }

    public function down()
    {
        $this->table("resource")
            ->removeIndexByName("idx_unique_code_in_resource")->save();
    }
}
